#include<stdio.h>
#include<stdlib.h>
int main()
{
    struct S
    {
      int n;
      int a[];
    };
    struct S* s=(struct S*)malloc(sizeof(struct S)+(5*sizeof(int)));
    if(s==NULL)
    {
        perror("malloc");
        return 1;
    }
    s->n=10;
    for(int i=0;i<5;i++)
    {
        s->a[i]=i;
        printf("%d ",s->a[i]);
    }
    printf("\n");
    int* p=(int*)realloc(s,sizeof(struct S)+(10*sizeof(int)));
    if(p!=NULL)
    {
      s=(struct S*)p;
    }
    for(int i=0;i<10;i++)
    {
        s->a[i]=i;
        printf("%d ",s->a[i]);
    }
    printf("\n");
    free(s);
    s=NULL;
    return 0;
}